//David Barbee
//CS4323
//Programming Assignment #1

package edu.ou.cs.cc.barbee.hw2;

import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;

public class Main2 {

	/**
	 * @param args
	 */

	static ArrayList<Character> inputtape;
	static ArrayList<String> tokensfound = new ArrayList<String>();
	static ArrayList<String> SYMTAB = new ArrayList<String>(100);
	static int tapehead = 0;
	static int linenumber = 1;
	static boolean endoftape = false;
	static boolean errorstate=false;
	static String token;

	
	static void ERRORHANDLER(String tokensofar, int errorlinenumber, String errormsg){
		errorstate=true;
		tapehead++;
		char c = inputtape.get(tapehead);
		while(!(Character.isWhitespace(c) || c == '#' || c == ':' || c == ',' 
				|| c == ';'	|| c == '(' || c == ')' || c == '[' || c == ']'
				|| c == '=' || c == '<'	|| c == '>' || c == '+'	|| c == '*' 
				|| c == '@'	|| c == '$')){
			tokensofar+=c;
			tapehead++;
			c=inputtape.get(tapehead);
		}
		System.out.println("ILLEGAL TOKEN " + errorlinenumber + ": \"" + tokensofar + "\" -- " + errormsg);

	}
	
	static void BOOKKEEPER(String newentry) {
		boolean addnewentry=true;
		for(int i=0;i<SYMTAB.size();i++){
			if(SYMTAB.get(i).equals(newentry)){
				addnewentry=false;
			}
		}
		if(addnewentry){	
			SYMTAB.add(newentry);
		}
	}
	


	//SCANNER defines a DFA using goto block structure (using Java switch statement)
	static String[] SCANNER() {
		token = "";
		boolean gottoken=false;
		errorstate=false;
		int block=0;
		char c;
		do{
			c=inputtape.get(tapehead);
			
			switch (block){
			
			case 0: 
				if(c == 'd'){
					block=1;
					token+=c;
					tapehead++;
				}
				else if(c == '$'){
					block=6;
					token+=c;
				}
				else if (Character.isWhitespace(c)){
					tapehead++;
				}
				else if (c == 'm'){
					block=8;
					token+=c;
					tapehead++;
				}
				else if (c == ':'){
					block = 13;
					token+=c;
				}
				else if (c == '#'){
					//start of comment. ignore the # symbol and everything after it on this line
					while(c != '\n' && c != '$'){
						c = inputtape.get(tapehead++);
					}
				}
				else if (c == ','){
					block = 15;
					token+=c;
				}
				else if (c == ';'){
					block = 16;
					token+=c;
				}
				else if (c == '('){
					block = 17;
					token+=c;
				}
				else if (c == ')'){
					block = 18;
					token+=c;
				}
				else if (c == '['){
					block = 19;
					token+=c;
				}
				else if (c == ']'){
					block = 20;
					token+=c;
				}
				else if (c == '='){
					block = 21;
					token+=c;
				}
				else if (c == '<'){
					block = 22;
					token+=c;
				}
				else if (c == '>'){
					block = 23;
					token+=c;
				}
				else if (c == '+'){
					block = 24;
					token+=c;
				}
				else if (c == '*'){
					block = 25;
					token+=c;
				}
				else if (c == '@'){
					block = 26;
					token+=c;
				}
				
				else if (c == 'r'){
					block=27;
					token+=c;
					tapehead++;
				}
				else if (c=='p'){
					block=37;
					token+=c;
					tapehead++;
				}
				else if (c=='i'){
					block=43;
					token+=c;
					tapehead++;
				}
				else if (c=='g'){
					block=52;
					token+=c;
					tapehead++;
				}
				else if (c=='b'){
					block=59;
					token+=c;
					tapehead++;
				}
				else if (c=='c'){
					block=65;
					token+=c;
					tapehead++;
				}
				else if (c == 'e'){
					block=74;
					token+=c;
					tapehead++;
				}
				else if (c=='w'){
					block=82;
					token+=c;
					tapehead++;
				}
				else if (c=='n'){
					block=88;
					token+=c;
					tapehead++;
				}
				else if (c=='t'){
					block=92;
					token+=c;
					tapehead++;
				}
				else if (c=='f'){
					block=97;
					token+=c;
					tapehead++;
				}
				else if (c=='a'){
					block=103;
					token+=c;
					tapehead++;
				}
				else if (c=='o'){
					block=107;
					token+=c;
					tapehead++;
				}				
				
				else if (Character.isLetter(c) && Character.isLowerCase(c)){
					block=7;
					token+=c;
					tapehead++;
				}
				
				else if (Character.isDigit(c)){
					block=110;
					token+=c;
					tapehead++;
				}
				else if (c == '.'){
					block=113;
					token+=c;
					tapehead++;
				}
				
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token does not start with valid character.");
					gottoken=true;
				}
				
				break;
				
				
			
			case 1: //d
				if(c == 'e'){
					block=2;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id d
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 2: //de
				if(c == 'f'){
					block=3;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id de
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
			
			case 3: //def
				if(Character.isWhitespace(c) || c == '#' || c == ':'
				|| c == ',' || c == ';'	|| c == '(' || c == ')' 
				|| c == '[' || c == ']'	|| c == '=' || c == '<'	
				|| c == '>' || c == '+'	|| c == '*' || c == '@'
				|| c == '$') {
					//then we have token keyword def
					block=4;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 4: //keyword def
				//if we get to this state we know we have keyword def
				//followed by some type of whitespace, special symbol,
				//or the end of input symbol. find out which one.
				if(c == '\n') {
					gottoken=true;
					tokensfound.add(token + " keyword " + --linenumber );
					tapehead++;
				}
				else if(c == '#' || c == ':' || c == ',' || c == ';'
						|| c == '(' || c == ')' || c == '[' || c == ']'
						|| c == '=' || c == '<'	|| c == '>' || c == '+'
						|| c == '*' || c == '@') {
					//don't advance tapehead because this special symbol
					//will be the token next time scanner is called
					gottoken=true;
					tokensfound.add(token + " keyword " + linenumber);
				}
			
				
				else {
					//keyword def was followed by some other whitespace
					//besides a newline character
					tokensfound.add(token + " keyword " + linenumber);
					gottoken=true;
				}
				break;
				
			case 5: // complete id
				//if we get to this state we know we have an id
				//followed by some type of whitespace, special symbol,
				//or the end of input symbol. find out which one.
				if(c == '\n') {
					gottoken=true;
					tokensfound.add(token + " id " + --linenumber );
					BOOKKEEPER(token + " id");
					tapehead++;
				}
				else if(c == '#' || c == ':' || c == ',' || c == ';'
						|| c == '(' || c == ')' || c == '[' || c == ']'
						|| c == '=' || c == '<'	|| c == '>' || c == '+'
						|| c == '*' || c == '@') {
					//don't advance tapehead because this special symbol
					//will be the token next time scanner is called
					gottoken=true;
					tokensfound.add(token + " id " + linenumber);
					BOOKKEEPER(token + " id");
				}
			
				else {
					//id was followed by some other whitespace
					//besides a newline character
					tokensfound.add(token + " id " + linenumber);
					BOOKKEEPER(token + " id");
					gottoken=true;
				}
				break;
				
			case 6: //$ end of source
				gottoken=true;
				endoftape=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				break;
				
			case 7: //id in progress
				if(Character.isWhitespace(c) || c == '#' || c == ':'
				|| c == ',' || c == ';'	|| c == '(' || c == ')' 
				|| c == '[' || c == ']'	|| c == '=' || c == '<'	
				|| c == '>' || c == '+'	|| c == '*' || c == '@'
				|| c == '$'){
					//id is complete
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//the id continues
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 8: //m
				if(c == 'a'){
					block=9;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id m
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
					|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 9: //ma
				if(c == 'i'){
					block=10;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id ma
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;

				
			case 10: //mai
				if(c == 'n'){
					block=11;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id mai
					block=5;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 11: //main
				if(Character.isWhitespace(c) || c == '#' || c == ':'
				|| c == ',' || c == ';'	|| c == '(' || c == ')' 
				|| c == '[' || c == ']'	|| c == '=' || c == '<'	
				|| c == '>' || c == '+'	|| c == '*' || c == '@'
				|| c == '$') {
					//then we have token keyword main
					block=12;
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 12: //keyword main
				//if we get to this state we know we have keyword main
				//followed by some type of whitespace, special symbol,
				//or the end of input symbol. find out which one.
				if(c == '\n') {
					gottoken=true;
					tokensfound.add(token + " keyword " + --linenumber );
					tapehead++;
				}
				else if(c == '#' || c == ':' || c == ',' || c == ';'
						|| c == '(' || c == ')' || c == '[' || c == ']'
						|| c == '=' || c == '<'	|| c == '>' || c == '+'
						|| c == '*' || c == '@') {
					//don't advance tapehead because this special symbol
					//will be the token next time scanner is called
					gottoken=true;
					tokensfound.add(token + " keyword " + linenumber);
				}
			
				
				else {
					//keyword main was followed by some other whitespace
					//besides a newline character
					tokensfound.add(token + " keyword " + linenumber);
					gottoken=true;
				}
				break;
				
			case 13: //s.symbol :
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 15: //s.symbol ,
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 16: //s.symbol ;
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 17: //s.symbol (
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 18: //s.symbol )
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 19: //s.symbol [
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 20: //s.symbol ]
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 21: //s.symbol =
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 22: //s.symbol <
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 23: //s.symbol >
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 24: //s.symbol +
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 25: //s.symbol *
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 26: //s.symbol @
				gottoken=true;
				tokensfound.add(token + " s.symbol " + linenumber);
				tapehead++;
				break;
				
			case 27: //r
				if(c == 'e'){
					block=28;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id r
					block=5; //go to block 5: completed ID
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 28: //re
				if(c == 'a'){
					block=29;
					token+=c;
					tapehead++;
				}
				else if(c == 't'){
					block=32;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id re
					block=5; //block 5: completed id
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 29: //rea
				if(c == 'd'){
					block=30;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id rea
					block=5; //block 5: completed id
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				break;
				
			case 30: //read
				if(Character.isWhitespace(c) || c == '#' || c == ':'
				|| c == ',' || c == ';'	|| c == '(' || c == ')' 
				|| c == '[' || c == ']'	|| c == '=' || c == '<'	
				|| c == '>' || c == '+'	|| c == '*' || c == '@'
				|| c == '$') {
					//then we have token keyword read
					block=31; //block 31: keyword read
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 31: //keyword read
				//if we get to this state we know we have keyword read
				//followed by some type of whitespace, special symbol,
				//or the end of input symbol. find out which one.
				if(c == '\n') {
					gottoken=true;
					tokensfound.add(token + " keyword " + --linenumber );
					tapehead++;
				}
				else if(c == '#' || c == ':' || c == ',' || c == ';'
						|| c == '(' || c == ')' || c == '[' || c == ']'
						|| c == '=' || c == '<'	|| c == '>' || c == '+'
						|| c == '*' || c == '@') {
					//don't advance tapehead because this special symbol
					//will be the token next time scanner is called
					gottoken=true;
					tokensfound.add(token + " keyword " + linenumber);
				}
			
				
				else {
					//keyword read was followed by some other whitespace
					//besides a newline character
					tokensfound.add(token + " keyword " + linenumber);
					gottoken=true;
				}
				break;
				
			case 32: //ret
				if(c == 'u'){
					block=33;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id ret
					block=5; //block 5: completed id
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 33: //retu
				if(c == 'r'){
					block=34;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id retu
					block=5; //block 5: completed id
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 34: //retur
				if(c == 'n'){
					block=35;
					token+=c;
					tapehead++;
				}
				else if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
					//then we have token id retur
					block=5; //block 5: completed id
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			
				
			case 35: // return
				if(Character.isWhitespace(c) || c == '#' || c == ':'
				|| c == ',' || c == ';'	|| c == '(' || c == ')' 
				|| c == '[' || c == ']'	|| c == '=' || c == '<'	
				|| c == '>' || c == '+'	|| c == '*' || c == '@'
				|| c == '$') {
					//then we have token keyword return
					block=36; //block 36: keyword return
				}
				else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
					//then this is going to be an id
					block=7;
					token+=c;
					tapehead++;
				}
				else{
					token+=c;
					ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
							"Are you using uppercase or illegal special characters?");
					gottoken=true;
				}
				break;
				
			case 36: //keyword return
				//if we get to this state we know we have keyword return
				//followed by some type of whitespace, special symbol,
				//or the end of input symbol. find out which one.
				if(c == '\n') {
					gottoken=true;
					tokensfound.add(token + " keyword " + --linenumber );
					tapehead++;
				}
				else if(c == '#' || c == ':' || c == ',' || c == ';'
						|| c == '(' || c == ')' || c == '[' || c == ']'
						|| c == '=' || c == '<'	|| c == '>' || c == '+'
						|| c == '*' || c == '@') {
					//don't advance tapehead because this special symbol
					//will be the token next time scanner is called
					gottoken=true;
					tokensfound.add(token + " keyword " + linenumber);
				}
			
				
				else {
					//keyword return was followed by some other whitespace
					//besides a newline character
					tokensfound.add(token + " keyword " + linenumber);
					gottoken=true;
				}
				break;
				
				case 37: //p
					if(c == 'r'){
						block=38;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id p
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 38: //pr
					if(c == 'i'){
						block=39;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id pr
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 39: //pri
					if(c == 'n'){
						block=40;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id pri
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 40: //prin
					if(c == 't'){
						block=41;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id prin
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				
				case 41: //print
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword print
						block=42;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 42: //keyword print
					//if we get to this state we know we have keyword print
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword print was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
				case 43: //i
					if(c == 'f'){
						block=44;
						token+=c;
						tapehead++;
					}
					else if(c == 'm'){
						block=46;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id i
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				
				
				case 44: //if
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword if
						block=45;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					
					break;
					
				case 45: //keyword if
					//if we get to this state we know we have keyword if
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword if was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
				case 46: //im
					if(c == 'p'){
						block=47;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id im
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 47: //imp
					if(c == 'o'){
						block=48;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id imp
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 48: //impo
					if(c == 'r'){
						block=49;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id impo
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 49: //impor
					if(c == 't'){
						block=50;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id impor
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 50: //import
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword import
						block=51;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 51: //keyword import
					//if we get to this state we know we have keyword import
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword if was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
				
				case 52: //g
					if(c == 'l'){
						block=53;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id g
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 53: //gl
					if(c == 'o'){
						block=54;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id gl
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 54: //glo
					if(c == 'b'){
						block=55;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id glo
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 55: //glob
					if(c == 'a'){
						block=56;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id glob
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 56: //globa
					if(c == 'l'){
						block=57;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id globa
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				
				
				
				case 57: //global
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword global
						block=58;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 58: //keyword global
					//if we get to this state we know we have keyword global
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword global was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
				case 59: //b
					if(c == 'r'){
						block=60;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id b
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 60: //br
					if(c == 'e'){
						block=61;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id br
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 61: //bre
					if(c == 'a'){
						block=62;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id bre
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 62: //brea
					if(c == 'k'){
						block=63;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id brea
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				
				case 63: //break
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword break
						block=64;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 64: //keyword break
					//if we get to this state we know we have keyword break
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword print was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
				case 65: //c
					if(c == 'o'){
						block=66;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id c
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 66: //co
					if(c == 'n'){
						block=67;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id co
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 67: //con
					if(c == 't'){
						block=68;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id con
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 68: //cont
					if(c == 'i'){
						block=69;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id cont
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 69: //conti
					if(c == 'n'){
						block=70;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id conti
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 70: //contin
					if(c == 'u'){
						block=71;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id contin
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 71: //continu
					if(c == 'e'){
						block=72;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id continu
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 72: //continue
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword continue
						block=73;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 73: //keyword continue
					//if we get to this state we know we have keyword continue
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword continue was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
				case 74: //e
					if(c == 'l'){
						block=75;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id e
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 75: //el
					if(c == 's'){
						block=76;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id el
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
				case 76: //els
					if(c == 'e'){
						block=77;
						token+=c;
						tapehead++;
					}
					else if(Character.isWhitespace(c) || c == '#' || c == ':'
							|| c == ',' || c == ';'	|| c == '(' || c == ')' 
							|| c == '[' || c == ']'	|| c == '=' || c == '<'	
							|| c == '>' || c == '+'	|| c == '*' || c == '@'
							|| c == '$') {
						//then we have token id els
						block=5;
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;

				
				case 77: //else
					if(Character.isWhitespace(c) || c == '#' || c == ':'
					|| c == ',' || c == ';'	|| c == '(' || c == ')' 
					|| c == '[' || c == ']'	|| c == '=' || c == '<'	
					|| c == '>' || c == '+'	|| c == '*' || c == '@'
					|| c == '$') {
						//then we have token keyword else
						block=78;
					}
					else if (c =='i'){ 
						block=79;
						token+=c;
						tapehead++;						
					}
					else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
						//then this is going to be an id
						block=7;
						token+=c;
						tapehead++;
					}
					else{
						token+=c;
						ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
								"Are you using uppercase or illegal special characters?");
						gottoken=true;
					}
					break;
					
				case 78: //keyword else
					//if we get to this state we know we have keyword else
					//followed by some type of whitespace, special symbol,
					//or the end of input symbol. find out which one.
					if(c == '\n') {
						gottoken=true;
						tokensfound.add(token + " keyword " + --linenumber );
						tapehead++;
					}
					else if(c == '#' || c == ':' || c == ',' || c == ';'
							|| c == '(' || c == ')' || c == '[' || c == ']'
							|| c == '=' || c == '<'	|| c == '>' || c == '+'
							|| c == '*' || c == '@') {
						//don't advance tapehead because this special symbol
						//will be the token next time scanner is called
						gottoken=true;
						tokensfound.add(token + " keyword " + linenumber);
					}
				
					
					else {
						//keyword else was followed by some other whitespace
						//besides a newline character
						tokensfound.add(token + " keyword " + linenumber);
						gottoken=true;
					}
					break;
					
					case 79: //elsei
						if(c == 'f'){
							block=80;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id elsei
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					
					
					case 80: //elseif
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword elseif
							block=81;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 81: //keyword elseif
						//if we get to this state we know we have keyword elseif
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword elseif was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 82: //w
						if(c == 'h'){
							block=83;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id w
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 83: //wh
						if(c == 'i'){
							block=84;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id wh
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 84: //whi
						if(c == 'l'){
							block=85;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id whi
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 85: //whil
						if(c == 'e'){
							block=86;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id whil
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
					
					case 86: //while
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword while
							block=87;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 87: //keyword while
						//if we get to this state we know we have keyword while
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword while was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 88: //n
						if(c == 'o'){
							block=89;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id n
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 89: //no
						if(c == 't'){
							block=90;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id no
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
					
					case 90: //not
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword not
							block=91;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 91: //keyword not
						//if we get to this state we know we have keyword not
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword not was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 92: //t
						if(c == 'r'){
							block=93;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id t
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 93: //tr
						if(c == 'u'){
							block=94;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id tr
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 94: //tru
						if(c == 'e'){
							block=95;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id tru
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 95: //true
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword true
							block=96;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 96: //keyword true
						//if we get to this state we know we have keyword true
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword true was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 97: //f
						if(c == 'a'){
							block=98;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id f
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 98: //fa
						if(c == 'l'){
							block=99;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id fa
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 99: //fal
						if(c == 's'){
							block=100;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id fal
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 100: //fals
						if(c == 'e'){
							block=101;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id fals
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
					
					case 101: //false
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword false
							block=102;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 102: //keyword false
						//if we get to this state we know we have keyword false
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword false was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 103: //a
						if(c == 'n'){
							block=104;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id a
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 104: //an
						if(c == 'd'){
							block=105;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id an
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
					
					case 105: //and
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword and
							block=106;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 106: //keyword and
						//if we get to this state we know we have keyword and
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword and was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 107: //o
						if(c == 'r'){
							block=108;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have token id o
							block=5;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					
					
					case 108: //or
						if(Character.isWhitespace(c) || c == '#' || c == ':'
						|| c == ',' || c == ';'	|| c == '(' || c == ')' 
						|| c == '[' || c == ']'	|| c == '=' || c == '<'	
						|| c == '>' || c == '+'	|| c == '*' || c == '@'
						|| c == '$') {
							//then we have token keyword or
							block=109;
						}
						else if ((Character.isLetter(c) && Character.isLowerCase(c))
						|| Character.isDigit(c) || c == '.'){
							//then this is going to be an id
							block=7;
							token+=c;
							tapehead++;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 109: //keyword or
						//if we get to this state we know we have keyword or
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " keyword " + --linenumber );
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " keyword " + linenumber);
						}
					
						
						else {
							//keyword or was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " keyword " + linenumber);
							gottoken=true;
						}
						break;
						
					case 110: //digit(s) - no decimal point
						if(Character.isDigit(c)){
							token+=c;
							tapehead++;
						}
						else if (c == '.'){
							block = 111;
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have an integer
							block=112;
						}
						else if (!Character.isDigit(c)){
							token+=c;
							ERRORHANDLER(token,linenumber,"Token starts with a digit and contains at least one letter. Identifiers cannot start with digits.");
							gottoken=true;
						}
						else{
							token+=c;
							ERRORHANDLER(token,linenumber,"Token contains invalid character(s). " +
									"Are you using uppercase or illegal special characters?");
							gottoken=true;
						}
						break;
						
					case 111: //digit(s) - one decimal point
						if(Character.isDigit(c)){
							token+=c;
							tapehead++;
						}
						else if(Character.isWhitespace(c) || c == '#' || c == ':'
								|| c == ',' || c == ';'	|| c == '(' || c == ')' 
								|| c == '[' || c == ']'	|| c == '=' || c == '<'	
								|| c == '>' || c == '+'	|| c == '*' || c == '@'
								|| c == '$') {
							//then we have a float
							block=112;
						}
						else if(c == '.'){
							token+=c;
							ERRORHANDLER(token,linenumber,"Token appears to be a constant number but contains more than one decimal point.");
							gottoken=true;
						}
						break;
					case 112: //constant
						//if we get to this state we know we have constant
						//followed by some type of whitespace, special symbol,
						//or the end of input symbol. find out which one.
						if(c == '\n') {
							gottoken=true;
							tokensfound.add(token + " constant " + --linenumber );
							BOOKKEEPER(token + " constant");
							tapehead++;
						}
						else if(c == '#' || c == ':' || c == ',' || c == ';'
								|| c == '(' || c == ')' || c == '[' || c == ']'
								|| c == '=' || c == '<'	|| c == '>' || c == '+'
								|| c == '*' || c == '@') {
							//don't advance tapehead because this special symbol
							//will be the token next time scanner is called
							gottoken=true;
							tokensfound.add(token + " constant " + linenumber);
							BOOKKEEPER(token + " constant");
						}
					
						
						else {
							//keyword or was followed by some other whitespace
							//besides a newline character
							tokensfound.add(token + " constant " + linenumber);
							gottoken=true;
						}
						break;	
						
					case 113: //one leading decimal point - no digits yet
						if(Character.isDigit(c)){
							block=111;
							token+=c;
							tapehead++;
						}
						if(Character.isWhitespace(c)){
							token+=c;
							ERRORHANDLER(token,linenumber,"A decimal point by itself is not a valid token.");
							gottoken=true;
						}
						break;
				
				
				
				

					


				

			}
			
			
			//keep track of what line of source we are on
			if(c == '\n'){
				linenumber++;
			}
		
			
		}while(!gottoken);
		
		//only print the last found token if it hasn't been printed already
		//that is if there is no error
		String[] tokenpair = new String[2];
		if(!errorstate){
			if(!tokensfound.isEmpty()){
				//System.out.println(tokensfound.get(tokensfound.size()-1));
				String currenttokendata = tokensfound.get(tokensfound.size()-1);
				int spaceindex = currenttokendata.indexOf(' ');
				String currenttoken = currenttokendata.substring(0,spaceindex);
				
				String therest = currenttokendata.substring(spaceindex+1);
				spaceindex = therest.indexOf(' ');
				String currenttype = therest.substring(0, spaceindex);
				
				
				switch (currenttoken){
					case "def":			//System.out.println("case switch found a def");
										tokenpair[0] = "def";
										tokenpair[1] = "3";
										return tokenpair;
												
					case "main":		tokenpair[0] = "main";
										tokenpair[1] = "4";
										return tokenpair;
									
					case "read":		tokenpair[0] = "read";
										tokenpair[1] = "5";
										return tokenpair;	
									
					case "print":		tokenpair[0] = "print";
										tokenpair[1] = "6";
										return tokenpair;
									
					case "import":		tokenpair[0] = "import";
										tokenpair[1] = "7";
										return tokenpair;	
									
					case "global":		tokenpair[0] = "global";
										tokenpair[1] = "8";
										return tokenpair;	
									
					case "break":		tokenpair[0] = "break";
										tokenpair[1] = "9";
										return tokenpair;
									
					case "continue":	tokenpair[0] = "continue";
										tokenpair[1] = "10";
										return tokenpair;		
										
					case "return":		tokenpair[0] = "return";
										tokenpair[1] = "11";
										return tokenpair;
										
					case "if":			tokenpair[0] = "if";
										tokenpair[1] = "12";
										return tokenpair;
										
					case "elseif":		tokenpair[0] = "elseif";
										tokenpair[1] = "13";
										return tokenpair;
										
					case "else":		tokenpair[0] = "else";
										tokenpair[1] = "14";
										return tokenpair;
										
					case "while":		tokenpair[0] = "while";
										tokenpair[1] = "15";
										return tokenpair;

					case "not":			tokenpair[0] = "not";
										tokenpair[1] = "16";
										return tokenpair;
										
					case "true":		tokenpair[0] = "true";
										tokenpair[1] = "17";
										return tokenpair;
										
					case "false":		tokenpair[0] = "false";
										tokenpair[1] = "18";
										return tokenpair;
										
					case "and":			tokenpair[0] = "and";
										tokenpair[1] = "19";
										return tokenpair;
										
					case "or":			tokenpair[0] = "or";
										tokenpair[1] = "20";
										return tokenpair;
										
					case "#":			tokenpair[0] = "#";
										tokenpair[1] = "21";
										return tokenpair;
										
					case ":":			tokenpair[0] = ":";
										tokenpair[1] = "22";
										return tokenpair;
										
					case ",":			tokenpair[0] = ",";
										tokenpair[1] = "23";
										return tokenpair;
										
					case ";":			tokenpair[0] = ";";
										tokenpair[1] = "24";
										return tokenpair;
										
					case "(":			tokenpair[0] = "(";
										tokenpair[1] = "25";
										return tokenpair;
										
					case ")":			tokenpair[0] = ")";
										tokenpair[1] = "26";
										return tokenpair;
										
					case "[":			tokenpair[0] = "[";
										tokenpair[1] = "27";
										return tokenpair;
										
					case "]":			tokenpair[0] = "]";
										tokenpair[1] = "28";
										return tokenpair;
										
					case "=":			tokenpair[0] = "=";
										tokenpair[1] = "29";
										return tokenpair;
										
					case "<":			tokenpair[0] = "<";
										tokenpair[1] = "30";
										return tokenpair;
										
					case ">":			tokenpair[0] = ">";
										tokenpair[1] = "31";
										return tokenpair;
										
					case "+":			tokenpair[0] = "+";
										tokenpair[1] = "32";
										return tokenpair;
										
					case "*":			tokenpair[0] = "*";
										tokenpair[1] = "33";
										return tokenpair;
										
					case "@":			tokenpair[0] = "@";
										tokenpair[1] = "34";
										return tokenpair;
					
					default:			if("id".equals(currenttype)){
											tokenpair[0] = currenttoken;
											tokenpair[1] = "1";
											return tokenpair;
										}
										else if("constant".equals(currenttype)){
											tokenpair[0]=currenttoken;
											tokenpair[1]="2";
											return tokenpair;
										}
										break;
				
				}
			}
		}
		
		tokenpair[0]="error";
		tokenpair[1]="error";
		return tokenpair;
		
	
	} //end SCANNER()
		
	static void PARSER(){
		System.out.println("Starting parser");
		
		
		String[] intcodes = {"Z_0","[id]","[const]","def","main","read",
				"print","import","global","break","continue","return",
				"if,","elseif","else","while","not","true","false","and",
				"or","#",":",",",";","(",")","[","]","=","<",">","+","*",
				"@","<python>","<def>","<more-defs>","<para-list>",
				"<block>","<id-list>","<stmt>","<stmts>","<more-ids>",
				"<more-stmts>","<input>","<output>","<asmt>","<import>",
				"<global>","<flow>","<cond>","<loop>","<expr-list>",
				"<expr>","<more-exprs>","<bool-expr>","<arith-expr>",
				"<elseif>","<else>","<elseif-list>","<more-elseif>",
				"<bool>","<comp>","<arith>"};
		
		//initialize the PDA stack where we will track int codes
		//and push the stack bottom marker (int 0) onto it
		Deque<Integer> stack = new ArrayDeque<Integer>();
		stack.push(0);
		
		int state = 0,step=0, lookahead=-1;
		boolean pdahalt=false,match=false;
		String action,stacktopstr,lookaheadstr;
		
		System.out.printf("%-15s %-15s %-15s %-15s\n",
				"Step",
				"Stack Top",
				"Lookahead",
				"Action");
		
		while(pdahalt==false){
			action="";
			stacktopstr=intcodes[stack.peek()] + " " + stack.peek();
			
			if(lookahead>=0){
				lookaheadstr=intcodes[lookahead] + " " + lookahead;
			}
			else{
				lookaheadstr=" ";
			}
			match = lookahead==stack.peek();
			
			if(!match){ // go through switch statement if stack top and
						// lookahead do not match
				
				switch (state){
				case 0:
					if(stack.peek()==0){
						state=1;
						stack.push(35);
						action="push <python>";
						lookahead=Integer.parseInt(SCANNER()[1]);
					}
					else{
						pdahalt=true;
					}
					break;
					
				
				
				case 1:
					if(stack.peek()==35){
						//lookahead = Integer.parseInt(SCANNER()[1]);
						if(lookahead==3){ //use rule 1
							stack.pop();
							stack.push(37);
							stack.push(36);
							action="use rule 1";
						}
						else{
							pdahalt=true;
						}
					}
					
					
					else if(stack.peek()==36){
						if(lookahead==3){ //use rule 2
							stack.pop();
							stack.push(39);
							stack.push(22);
							stack.push(26);
							stack.push(38);
							stack.push(25);
							stack.push(1);
							stack.push(3);
							action="use rule 2";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==37){
						//TODO 37 more-defs
					}
					
					else if(stack.peek()==38){
						if(lookahead==26){ //use rule 5
							stack.pop();
							action="use rule 5";
						}
						else if(lookahead==1){ //use rule 6
							stack.pop();
							stack.push(40);
							action="use rule 6";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==40){
						if(lookahead==1){ //use rule 9
							stack.pop();
							stack.push(43);
							stack.push(1);
							action="use rule 9";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==43){ //<more-ids>
						// lookahead ) = def elseif else ; ] use rule 10
						if(lookahead==26 || lookahead==29 ||lookahead==3
								||lookahead==13||lookahead == 14
								||lookahead==24||lookahead==28){  
							stack.pop();
							action="use rule 10";
						}
						else if(lookahead==23){ // comma , -- use rule 11
							stack.pop();
							stack.push(43);
							stack.push(1);
							stack.push(23);
							action="use rule 11";
						}
						else{
							pdahalt=true;
						}
					}
					
					

					
					else if(stack.peek()==39){ //<block>
						//lookahead read print [id] import global break
						//continue return if while use rule 7
						if(lookahead==5||lookahead==6||lookahead==1
								||lookahead==7||lookahead==8||lookahead==9
								||lookahead==10||lookahead==11||lookahead==12
								||lookahead==15){ 								
							stack.pop();
							stack.push(41);
							action="use rule 7";
						}
						else if(lookahead==27){ // [ use rule 8
							stack.pop();
							stack.push(28);
							stack.push(42);
							stack.push(27);
							action="use rule 8";
						}
						else{
							pdahalt=true;
						}
							
					}
					
					else if(stack.peek()==42){
						if(lookahead==5||lookahead==6||lookahead==1
								||lookahead==7||lookahead==8||lookahead==9
								||lookahead==10||lookahead==11||lookahead==12
								||lookahead==15){
							stack.pop();
							stack.push(44);
							stack.push(41);
							action="use rule 12";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==41){
						if(lookahead==5){ //use rule 15
							stack.pop();
							stack.push(45);
							action="use rule 15";
						}
						else if(lookahead==6){ //use rule 16
							stack.pop();
							stack.push(46);
							action="use rule 16";
						}
						else if(lookahead==1){ //use rule 17
							stack.pop();
							stack.push(47);
							action="use rule 17";
						}
						else if(lookahead==7){ //use rule 18
							stack.pop();
							stack.push(48);
							action="use rule 18";
						}
						else if(lookahead==8){ //use rule 19
							stack.pop();
							stack.push(49);
							action="use rule 19";
						}
						else if(lookahead==9 || lookahead==10
								|| lookahead==11){ //use rule 20
							stack.pop();
							stack.push(50);
							action="use rule 20";
						}
						else if(lookahead==12){ //use rule 21
							stack.pop();
							stack.push(51);
							action="use rule 21";
						}
						else if(lookahead==15){ //use rule 22
							stack.pop();
							stack.push(52);
							action="use rule 22";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==51){ //<cond>
						if(lookahead==12){ // if use rule 37
							stack.pop();
							stack.push(59);
							stack.push(58);
							stack.push(39);
							stack.push(22);
							stack.push(56);
							stack.push(12);
							action="use rule 37";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if(stack.peek()==56){ //<bool-expr>
						if(lookahead==16){ //not use rule 45
							stack.pop();
							stack.push(62);
							stack.push(26);
							stack.push(56);
							stack.push(25);
							stack.push(16);
							action="use rule 45";
						}
						else if(lookahead==17){ //true use rule 46
							stack.pop();
							stack.push(62);
							stack.push(17);
							action="use rule 46";
						}
						else if(lookahead==18){ //false use rule 47
							stack.pop();
							stack.push(62);
							stack.push(18);
							action="use rule 47";
						}
						else if(lookahead==30||lookahead==29
								||lookahead==31){ //< = > use rule 48
							stack.pop();
							stack.push(57);
							stack.push(57);
							stack.push(63);
							action="use rule 48";
						}
						else{
							pdahalt=true;
						}
					}
					
					else if( stack.peek()==63 ){ // <comp>
						if(lookahead==30){ // < use rule 52
							stack.pop();
							stack.push(30);
							action="use rule 52";
						}
						else if(lookahead==29){ // = use rule 53
							stack.pop();
							stack.push(29);
							action="use rule 53";
						}
						else if(lookahead==31){ // > use rule 54
							stack.pop();
							stack.push(31);
							action="use rule 54";
						}
						else{
							pdahalt=true;
						}
					}
				} //end switch statement
			} //end if !match
			else{
				action="match";
			}
			
			
			System.out.printf("%-15s %-15s %-15s %-15s\n",
			((Integer)step).toString(),
			stacktopstr,
			lookaheadstr,
			action);
			
			
		
//			else{
//				System.out.printf("%-15s %-15s %-15s %-15s\n",
//				((Integer)step).toString(),
//				intcodes[stack.peek()] + " " + stack.peek(),
//				" ",
//				action);
//				lookahead = Integer.parseInt(SCANNER()[1]);
//			}
			
			if(match){
				stack.pop();
				lookahead=Integer.parseInt(SCANNER()[1]);
				match=false;
			}
			step++;

		}//end pda loop
		
		System.out.println("Parsing completed");
		if(state==2){
			System.out.println("Input ACCEPTED");
		}
		else{
			System.out.println("Input REJECTED");
		}
		
		
		
		
		
		
		//main loop of the program. repeatedly call scanner until we reach
		//the end of the source code
		do{
			String[] scanneroutput = SCANNER();
			//System.out.println("scanner return -- " + scanneroutput[0] + " -- " + scanneroutput[1] + "\n");
		}while(!endoftape);
		
		System.out.println("\nFinished scanning.");
		
	}


	public static void main(String[] args) throws IOException {
		System.out.println("\nDavid Barbee");
		System.out.println("CS4323 HW2");
		
		//initialize an ArrayList of chars. we'll use this to store source
		inputtape = new ArrayList<Character>();
		
		//use a reader to read the source in from the file and store it in
		//the array list
		FileReader in = null;
		in = new FileReader("bin/edu/ou/cs/cc/barbee/hw2/input.txt");
		int c;
		while((c = in.read()) != -1) {
			inputtape.add((char) c);
		}		
		in.close();
		
		//print out the source program to be parsed exactly as we have
		//stored it in the array list
		System.out.println("Source program to be parsed:\n");
		for(int i=0;i<inputtape.size();i++){
			System.out.print(inputtape.get(i));
		}
		
		PARSER();
		
		//a HW2 requirement is to print SYMTAB content from the main body
		//of program
		System.out.println("\nSYMTAB:");
		System.out.println("[tok] [attrib/class]");
		for(int i=0;i<SYMTAB.size();i++){
			System.out.println(SYMTAB.get(i));
		}
		
		System.out.println("\nProgram halted");
		
	} //end main()

} //end class Main2